import React, { Component } from 'react';
import { Link, withRouter } from 'react-router-dom';
import history from 'src/history';
import './list.css';

class List extends Component{
	back() {
	    // this.props.history.go(-1);
	    history.go(-1);
  	}
	render(){
		return (
			<div>
				<p className="App-msg" onClick={this.back.bind(this)}>返回</p>
				<ul>
			        <li onClick={()=>history.push("/")}>首页</li>
			        <li onClick={()=>history.push("/list")}>列表</li>
			        <li onClick={()=>history.push("/detail")}>详情</li>
		      	</ul>
				{/*
					<ul>
				        <li onClick={()=>this.props.history.push("/")}>首页</li>
				        <li onClick={()=>this.props.history.push("/list")}>列表</li>
				        <li onClick={()=>this.props.history.push("/detail")}>详情</li>
			      	</ul>
			      */}
				<ul>
			        <li><Link to='/'>Home</Link></li>
			        <li><Link to='/list'>List</Link></li>
			        <li><Link to='/detail'>Detail</Link></li>
		      	</ul>
		      	<div>
		      		<h1>我是列表页</h1>
		      	</div>
			</div>
		)
	}
}

export default List;
// export default withRouter(List);